import xml.dom.minidom
from xml.dom.minidom import Node

class Interpreter:
	def __init__(self, node):
		self.name = ""
		self.parse(node)
		self.albums = []
	def parse(self, node):
		tmp = node.getElementsByTagName("artist")[0]
		lst = []
		for i in tmp.childNodes:
			if i.nodeType == i.TEXT_NODE:
				lst.append(i.data)
		self.name = ''.join(lst)
	def isExisting(self, album):
		for i in self.albums:
			if album.name == i.name:
				return i
		return None
	def addAlbum(self, album):
		tmp = self.isExisting(album)
		if tmp == None:
			self.albums.append(album)
		else:
			for i in album.titles:
				tmp.addTitle(i)
